package com.company.myfirstjmixproject.entity.bom;

import com.company.myfirstjmixproject.entity.enums.StateEnum;
import io.jmix.core.entity.annotation.JmixGeneratedValue;
import io.jmix.core.metamodel.annotation.InstanceName;
import io.jmix.core.metamodel.annotation.JmixEntity;

import javax.persistence.*;

@JmixEntity
@Table(name = "MST_ROUTING")
@Entity
public class Routing {
    @JmixGeneratedValue
    @Column(name = "ID", nullable = false)
    @Id
    private Long id;

    @Column(name = "VERSION", nullable = false)
    @Version
    private Integer version;

    @Column(name = "ROUTING_CODE", nullable = false)
    private String routingCode;

    @InstanceName
    @Column(name = "ROUTING_NAME", nullable = false)
    private String routingName;

    @Column(name = "ROUTING_DESC", nullable = false)
    private String routingDesc;

    @Column(name = "ROUTING_STATE",nullable = false)
    private String routingState;

    public String getRoutingCode() {
        return routingCode;
    }

    public void setRoutingCode(String routingCode) {
        this.routingCode = routingCode;
    }

    public String getRoutingName() {
        return routingName;
    }

    public void setRoutingName(String routingName) {
        this.routingName = routingName;
    }

    public String getRoutingDesc() {
        return routingDesc;
    }

    public void setRoutingDesc(String routingDesc) {
        this.routingDesc = routingDesc;
    }

    public StateEnum getRoutingState() {
        return routingState == null ? null : StateEnum.fromId(routingState);
    }

    public void setRoutingState(StateEnum routingState) {
        this.routingState = routingState == null ? null : routingState.getId();
    }

    public Integer getVersion() {
        return version;
    }

    public void setVersion(Integer version) {
        this.version = version;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }
}